Skip to content

(Lit) Style widgets using CSS variables.#1079

Merged
ditman merged 32 commits intogoogle:mainfrom
ditman:core-styling-all-widgets
Apr 14, 2026
Merged

(Lit) Style widgets using CSS variables.#1079
ditman merged 32 commits intogoogle:mainfrom
ditman:core-styling-all-widgets

Conversation

@ditman
Copy link
Copy Markdown
Collaborator

@ditman ditman commented Apr 7, 2026

Description

This PR adds styling based on CSS variables to the components of the basic catalog of the Lit renderer.

The PR uses the base styles defined in web_core, and adds per-component overrides that can be used to customize the appearance of each component further.

This PR continues #1057.

Pre-launch Checklist

If you need help, consider asking for advice on the discussion board.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a centralized theme injection system for A2UI components, adding a default style utility for global CSS variables and an injection function. Components across the basic and minimal catalogs are updated to use these variables and call the injection function in their lifecycle. Feedback identifies a missing theme injection in the basic Text component, suggests using internal CSS variables for better color inheritance in buttons, and recommends guarding document access to ensure compatibility with server-side rendering.

@ditman ditman force-pushed the core-styling-all-widgets branch 3 times, most recently from 903d6c6 to 3edb33b Compare April 8, 2026 20:39
@ditman ditman changed the title Core styling all widgets (Lit) Style widgets using CSS variables. Apr 9, 2026
@ditman ditman marked this pull request as ready for review April 9, 2026 02:39
@ditman
Copy link
Copy Markdown
Collaborator Author

ditman commented Apr 9, 2026

I'll address Gemini comments next

@ditman ditman mentioned this pull request Apr 9, 2026
6 tasks
@ditman ditman force-pushed the core-styling-all-widgets branch from c1ebcb5 to 2dcc0ca Compare April 9, 2026 17:55
@ditman ditman mentioned this pull request Apr 9, 2026
6 tasks
@ditman ditman requested a review from ava-cassiopeia April 9, 2026 17:57
@ditman
Copy link
Copy Markdown
Collaborator Author

ditman commented Apr 9, 2026

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request re-styles the v0_9 catalog components in the Lit renderer to utilize a new default theme provided by web_core. This involved introducing a new injectBasicCatalogStyles function in web_core that defines CSS variables for theming, including light/dark mode support. All v0_9 Lit components were updated to use static styles = css blocks and connectedCallback to inject these new styles, replacing previous inline styling and redundant div wrappers. The package.json and package-lock.json files were updated to reflect version bumps and new peer dependencies, and the CHANGELOG.md files were also updated. Review comments noted a breaking change in the Icon component's class name, an invalid CSS border property in CheckBox, a potential visual bug with the Divider component's content, an inconsistent hover color for the primary button, and an unidiomatic Lit pattern in the Image component.

background-color: var(--a2ui-color-secondary-hover, #ddd);
}
.a2ui-button.a2ui-button-primary:hover {
background-color: var(--a2ui-color-primary-hover, #fbd);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The fallback color #fbd (pink) for the primary button hover state is inconsistent with the primary blue theme (#17e). Consider using a color that aligns with the theme, such as a darker or lighter shade of blue.

Suggested change
background-color: var(--a2ui-color-primary-hover, #fbd);
background-color: var(--a2ui-color-primary-hover, #35f);

@ditman ditman force-pushed the core-styling-all-widgets branch from 2b7611b to ad16d84 Compare April 10, 2026 18:03
@ditman
Copy link
Copy Markdown
Collaborator Author

ditman commented Apr 10, 2026

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the v0.9 Lit catalog components to extend a new base class, BasicCatalogA2uiLitElement, which centralizes style injection and flex property management. The components now utilize Lit's static styles and CSS variables for enhanced customization, while the minimalCatalog has been deprecated and removed. Review feedback identifies mismatched CSS variable names in the Image component, redundant style logic in Column and Row that is already handled by the base class, and a missing default value for the CheckBox border variable.

@ditman
Copy link
Copy Markdown
Collaborator Author

ditman commented Apr 11, 2026

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the Lit v0.9 basic catalog components by introducing a BasicCatalogA2uiLitElement base class to handle style injection and flex-weight properties. All components are migrated to use encapsulated static styles with CSS variables for theming, and the minimal catalog is removed in favor of the basic catalog. Feedback includes addressing a layout issue with horizontal dividers, ensuring the flex property is reset when weight is undefined, fixing inconsistent hover colors and CSS variable documentation, and simplifying class assignments.

@ditman ditman force-pushed the core-styling-all-widgets branch from 2e933c2 to ca590b6 Compare April 13, 2026 16:19
@ditman
Copy link
Copy Markdown
Collaborator Author

ditman commented Apr 14, 2026

Landing this, it's getting unwieldy to maintain all the dependent PRs I have after this one.

@ditman ditman merged commit 4619bac into google:main Apr 14, 2026
12 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in A2UI Apr 14, 2026
@ditman ditman deleted the core-styling-all-widgets branch April 14, 2026 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants